CFLAGS = -fpic -coverage -lm -std=c99

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)

testDrawCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
	gcc -o badTestDrawCard -g  badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

testAll: dominion.o testSuite.c
	gcc -o testSuite testSuite.c -g  dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

runtests: testDrawCard 
	./testDrawCard &> unittestresult.out
	gcov dominion.c >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out

player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

unittestresults.out: unittest1.c unittest2.c unittest3.c unittest4.c dominion.o rngs.o
	gcc -o unittest1 -g unittest1.c dominion.o rngs.o $(CFLAGS)
	gcc -o unittest2 -g unittest2.c dominion.o rngs.o $(CFLAGS)
	gcc -o unittest3 -g unittest3.c dominion.o rngs.o $(CFLAGS)
	gcc -o unittest4 -g unittest4.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest1 -g cardtest1.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest2 -g cardtest2.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest3 -g cardtest3.c dominion.o rngs.o $(CFLAGS)
	gcc -o cardtest4 -g cardtest4.c dominion.o rngs.o $(CFLAGS)
	./unittest1 >> unittestresults.out
	./unittest2 >> unittestresults.out
	./unittest3 >> unittestresults.out
	./unittest4 >> unittestresults.out
	./cardtest1 >> unittestresults.out
	./cardtest2 >> unittestresults.out
	./cardtest3 >> unittestresults.out
	./cardtest4 >> unittestresults.out
	gcov unittest1.c >> unittestresults.out
	gcov unittest2.c >> unittestresults.out
	gcov unittest3.c >> unittestresutlts.out
	gcov unittest4.c >> unittestresults.out
	gcov cardtest1.c >> unittestresults.out
	gcov cardtest2.c >> unittestresults.out
	gcov cardtest3.c >> unittestresults.out
	gcov cardtest4.c >> unittestresults.out
	cat unittest1.c.gcov >> unittestresults.out
	cat unittest2.c.gcov >> unittestresults.out
	cat unittest3.c.gcov >> unittestresults.out
	cat unittest4.c.gcov >> unittestresults.out
	cat cardtest1.c.gcov >> unittestresults.out
	cat cardtest2.c.gcov >> unittestresults.out
	cat cardtest3.c.gcov >> unittestresults.out
	cat cardtest4.c.gcov >> unittestresults.out


all: playdom player testDrawCard testBuyCard badTestDrawCard

random: randomtestcard.c randomtestadventurer.c testdominion.c dominion.o rngs.o
	gcc -c randomtestcard.c -g $(CFLAGS)
	gcc -c randomtestaventurer.c -g $(CFLAGS)
	gcc -o testdominion -g testdominion.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards -g testAllCards.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards1 -g testAllCards1.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards2 -g testAllCards2.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards3 -g testAllCards3.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards4 -g testAllCards4.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards5 -g testAllCards5.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards6 -g testAllCards6.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards7 -g testAllCards7.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards8 -g testAllCards8.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards9 -g testAllCards9.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards10 -g testAllCards10.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards11 -g testAllCards11.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards12 -g testAllCards12.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards13 -g testAllCards13.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards14 -g testAllCards14.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards15 -g testAllCards15.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o testAllCards16 -g testAllCards16.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)
	gcc -o tarantula2 -g tarantula2.c dominion.o rngs.o -ftest-coverage -fprofile-arcs $(CFLAGS)


random1: testdominion.c
	gcc -c testdominion.c -g $(CFLAGS)

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testInit testInit.exe *.gcov *.gcda *.gcno *.so
